home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / text / print / audioed.lha / AudioED313 / Install-AudioED next >
Text File  |  1996-11-17  |  38KB  |  1,345 lines

  1. ;--------------------------------------------------------------------------
  2. ;
  3. ; $VER: AudioED V 3.13 (06.10.96)
  4. ;
  5. ; Copyright © 1996 by Frank Enderle
  6. ;
  7. ; This is the installation script for the Amiga Technologies Installer (tm)
  8. ;
  9. ;--------------------------------------------------------------------------
  10.  
  11. ; init section
  12.  
  13. (onerror (exit (quiet)))
  14.  
  15. (set new-ver     3)
  16. (set new-rev     13)
  17. (set drawer-name "AudioED")
  18. (set def-volume  "SYS:")
  19.  
  20. (set do-update   0)
  21. (set do-install  0)
  22. (set do-remove   0)
  23.  
  24. (set cat-lang    0)
  25. (set man-lang    0)
  26.  
  27. ;==========================================================================
  28. ; LOCALES
  29.  
  30. ;----- Language: Deutsch -----
  31.  
  32. (if (= @language "deutsch")
  33.   (
  34.     (set #wrong-kickstart (cat "\n"
  35.                                "Tut mir Leid, aber AudioED benötigt\n"
  36.                                "mindestens Kickstart 3.0 um gestartet\n"
  37.                                "werden zu können."
  38.                           )
  39.     )
  40.  
  41.     (set #welcome         (cat "\n"
  42.                                "Willkommen bei dem Installer-Skript für\n"
  43.                                "\n"
  44.                                "AudioED Version 3.13\n"
  45.                                "\n"
  46.                                "Alle Dateien dieser Distribution sind\n"
  47.                                "Copyright © 1994-96 by Frank Enderle"
  48.                           )
  49.     )
  50.  
  51.     (set #getdrawer       (cat "Wählen Sie ein Verzeichnis, in dem AudioED "
  52.                                "installiert werden soll. "
  53.                                "Dieses Skript erzeugt dort bei der Installation "
  54.                                "ein Verzeichnis mit dem Namen 'AudioED'\n\n"
  55.                                "Ist bereits eine AudioED Version installiert, "
  56.                                "so können Sie diese updaten oder löschen."
  57.                           )
  58.     )
  59.  
  60.     (set #getdrawer-help  (cat "Wählen Sie ein Verzeichnis aus, in welchem AudioED "
  61.                                "installiert werden soll bzw. bereits installiert ist. "
  62.                                "Das Skript erzeugt dort bei der Installation (und nur "
  63.                                "dann) ein Verzeichnis mit dem Namen 'AudioED' Ist "
  64.                                "bereits eine AudioED Version installiert, so können "
  65.                                "Sie diese updaten oder löschen."
  66.                           )
  67.     )
  68.  
  69.     (set #deinstall       (cat "Es ist bereits diese Version von AudioED "
  70.                                "installiert. Wollen Sie diese löschen? "
  71.                           )
  72.     )
  73.  
  74.     (set #deinst-update   (cat "Es ist bereits eine Version von AudioED "
  75.                                "installiert. Bitte wählen Sie, ob Sie ein "
  76.                                "Update durchführen möchten, oder ob AudioED "
  77.                                "gelöscht werden soll."
  78.                           )
  79.     )
  80.  
  81.     (set #deinst-ch-0     (cat "Update durchführen (empfohlen)"
  82.                           )
  83.     )
  84.  
  85.     (set #deinst-ch-1     (cat "AudioED entfernen"
  86.                           )
  87.     )
  88.  
  89.     (set #reinit-key      (cat "Es ist bereits diese Version von AudioED "
  90.                                "installiert. "
  91.                           )
  92.     )
  93.  
  94.     (set #reinit-ch-0     (cat "AudioED entfernen"
  95.                           )
  96.     )
  97.  
  98.     (set #reinit-ch-1     (cat "Keyfile neu installieren"
  99.                           )
  100.     )
  101.  
  102.     (set #lang-cat        (cat "Welche Sprachkataloge möchten Sie installieren?"
  103.                           )
  104.     )
  105.  
  106.     (set #lang-cat-ch-0   (cat "English"
  107.                           )
  108.     )
  109.  
  110.     (set #lang-cat-ch-1   (cat "Deutsch"
  111.                           )
  112.     )
  113.  
  114.     (set #lang-cat-ch-2   (cat "Svenska"
  115.                           )
  116.     )
  117.  
  118.     (set #lang-cat-ch-3   (cat "Français"
  119.                           )
  120.     )
  121.  
  122.     (set #lang-man        (cat "Welche Anleitungen sollen installiert werden?"
  123.                           )
  124.     )
  125.  
  126.     (set #lang-man-ch-0   (cat "English"
  127.                           )
  128.     )
  129.  
  130.     (set #lang-man-ch-1   (cat "Deutsch"
  131.                           )
  132.     )
  133.  
  134.     (set #lang-error      (cat "\nSie müssen mindestens eine Sprache auswählen"
  135.                           )
  136.     )
  137.  
  138.     (set #user-startup    (cat "Es müssen ein paar Zeilen in die Datei \"s:user-startup\" "
  139.                                "eingebunden werden."
  140.                           )
  141.     )
  142.  
  143.     (set #user-startup-rm (cat "Es müssen ein paar Zeilen in der Datei \"s:user-startup\" "
  144.                                "entfernt werden."
  145.                           )
  146.     )
  147.  
  148.     (set #removed         (cat "AudioED wurde komplett gelöscht"
  149.                           )
  150.     )
  151.  
  152.     (set #gettapes        (cat "In welchem Verzeichnis sind Ihre Kassetten gespeichert? Wählen "
  153.                                "Sie das Verzeichnis aus, IN DEM die .idx und .dat Dateien gespeichert "
  154.                                "sind!!!"
  155.                           )
  156.     )
  157.  
  158.     (set #update-info-0   (cat "Das alte Verzeichnis wird in AudioED_old umbenannt. Es "
  159.                                "werden keine Dateien darin verändert. Sollte die neue "
  160.                                "Version nicht korrekt funktionieren, so können Sie "
  161.                                "dennoch die alte Version von AudioED benutzen."
  162.                           )
  163.     )
  164.  
  165.     (set #update-info-1   (cat "Die Dateien, welche aus dem System entfernt werden müssen, "
  166.                                "werden in AudioED_old/backups mit ihrer Pfadstruktur gespeichert."
  167.                           )
  168.     )
  169.  
  170.     (set #work-r-conv     (cat "Konvertiere Konfigurationsdateien..."
  171.                           )
  172.     )
  173.  
  174.     (set #work-d-conv     (cat "Konvertiere Datenbank(en)..."
  175.                           )
  176.     )
  177.  
  178.     (set #work-backup     (cat "Erstelle Sicherheitskopien..."
  179.                           )
  180.     )
  181.  
  182.     (set #no-keyfile      (cat "\nDieses Archiv ist nicht registriert. Um AudioED voll "
  183.                                "funktionsfähig zu machen, müssen Sie sich registrieren "
  184.                                "lassen. Lesen Sie den Punkt 'Registrieren' in der "
  185.                                "Anleitung zu AudioED."
  186.                           )
  187.     )
  188.  
  189.     (set #restart         (cat "\nUm AudioED korrekt starten zu können, müssen Sie nach "
  190.                                "beenden des Installationsvorgangs den Rechner neu starten."
  191.                           )
  192.     )
  193.  
  194.     (set #no-lha          (cat "\nUm AudioED zu installieren benötigen Sie LHA, was ich "
  195.                                "aus rechtlichen Gründen dem Archiv nicht beifügen konnte. "
  196.                                "Sie können es aber jederzeit vom Aminet beziehen. "
  197.                           )
  198.     )
  199.  
  200.     (set #extract-prg-0   (cat "\nEntpacke AudioED für 68000..."
  201.                           )
  202.     )
  203.  
  204.     (set #extract-prg-1   (cat "\nEntpacke AudioED für 68020+..."
  205.                           )
  206.     )
  207.  
  208.     (set #extract-err     (cat "\nFehler beim entpacken des Archivs"
  209.                           )
  210.     )
  211.   )
  212.  
  213. ;----- Language: English -----
  214.  
  215.   (
  216.     (set #wrong-kickstart (cat "\n"
  217.                                "I'm sorry but AudioED needs at least\n"
  218.                                "Kickstart 3.0 to do its work."
  219.                           )
  220.     )
  221.  
  222.     (set #welcome         (cat "\n"
  223.                                "Welcome to the Installer-Script for\n"
  224.                                "\n"
  225.                                "AudioED Version 3.13\n"
  226.                                "\n"
  227.                                "All file in this distribution are\n"
  228.                                "Copyright © 1994-96 by Frank Enderle"
  229.                           )
  230.     )
  231.  
  232.     (set #getdrawer       (cat "Please select a drawer where to install AudioED. "
  233.                                "This script will create a directory named 'AudioED' "
  234.                                "while the installation procedure.\n\n"
  235.                                "If there's already an AudioED version installed, "
  236.                                "you will be asked if you want to update or remove it."
  237.                           )
  238.     )
  239.  
  240.     (set #getdrawer-help  (cat "Please select a drawer where to install AudioED or "
  241.                                "where AudioED is already installed. This script will "
  242.                                "create a directory named 'AudioED' while (and only then) "
  243.                                "the installation procedure. If there's already an "
  244.                                "AudioED version installed, you will ask be asked if you "
  245.                                "want to update or remove it."
  246.                           )
  247.     )
  248.  
  249.     (set #deinstall       (cat "There's already this version of AudioED installed. "
  250.                                "Do you want to delete that installation?"
  251.                           )
  252.     )
  253.  
  254.     (set #deinst-update   (cat "There's already a version of AudioED installed. "
  255.                                "Please select if you want to perform an update "
  256.                                "or if you wish to delete the installation."
  257.                           )
  258.     )
  259.  
  260.     (set #deinst-ch-0     (cat "Perform update (recommended)"
  261.                           )
  262.     )
  263.  
  264.     (set #deinst-ch-1     (cat "Remove AudioED"
  265.                           )
  266.     )
  267.  
  268.     (set #reinit-key      (cat "There's already this version of AudioED installed. "
  269.                           )
  270.     )
  271.  
  272.     (set #reinit-ch-0     (cat "Remove AudioED"
  273.                           )
  274.     )
  275.  
  276.     (set #reinit-ch-1     (cat "Reinstall keyfile"
  277.                           )
  278.     )
  279.  
  280.     (set #lang-cat        (cat "Select which languages-catalogs you wish to "
  281.                                "have installed"
  282.                           )
  283.     )
  284.  
  285.     (set #lang-cat-ch-0   (cat "English"
  286.                           )
  287.     )
  288.  
  289.     (set #lang-cat-ch-1   (cat "Deutsch"
  290.                           )
  291.     )
  292.  
  293.     (set #lang-cat-ch-2   (cat "Svenska"
  294.                           )
  295.     )
  296.  
  297.     (set #lang-cat-ch-3   (cat "Français"
  298.                           )
  299.     )
  300.  
  301.     (set #lang-man        (cat "Which manuals should be installed?"
  302.                           )
  303.     )
  304.  
  305.     (set #lang-man-ch-0   (cat "English"
  306.                           )
  307.     )
  308.  
  309.     (set #lang-man-ch-1   (cat "Deutsch"
  310.                           )
  311.     )
  312.  
  313.     (set #lang-error      (cat "\nYou must select at least one language"
  314.                           )
  315.     )
  316.  
  317.     (set #user-startup    (cat "Some commands will be added to your "
  318.                                "\"s:user-startup\" file."
  319.                           )
  320.     )
  321.  
  322.     (set #user-startup-rm (cat "Some commands will be removed from your "
  323.                                "\"s:user-startup\" file."
  324.                           )
  325.     )
  326.  
  327.     (set #removed         (cat "AudioED was entirely removed."
  328.                           )
  329.     )
  330.  
  331.     (set #gettapes        (cat "In which directory have you saved your tapes? Select "
  332.                                "the directory WHICH CONTAINS the .idx and .dat files!!!"
  333.                           )
  334.     )
  335.  
  336.     (set #update-info-0   (cat "The old directory will be renamed to AudioED_old. No "
  337.                                "files will be changed in that directory. If the new "
  338.                                "version won't work then you can use at least the "
  339.                                "old version of AudioED."
  340.                           )
  341.     )
  342.  
  343.     (set #update-info-1   (cat "The file which must be removed from the system will be saved "
  344.                                "with their directory structure in AudioED_old/backups."
  345.                           )
  346.     )
  347.  
  348.     (set #work-r-conv     (cat "Converting configuration files..."
  349.                           )
  350.     )
  351.  
  352.     (set #work-d-conv     (cat "Converting database(s)..."
  353.                           )
  354.     )
  355.  
  356.     (set #work-backup     (cat "Creating backups..."
  357.                           )
  358.     )
  359.  
  360.     (set #no-keyfile      (cat "\nThis archive is unregistered. To get AudioED in the "
  361.                                "full version you need to get registered. Read the topic "
  362.                                "'Register' in the AudioED manual."
  363.                           )
  364.     )
  365.  
  366.     (set #restart         (cat "\nTo get AudioED working without problems you'll have to "
  367.                                "restart the computer after you completed the install "
  368.                                "procedure."
  369.                           )
  370.     )
  371.  
  372.     (set #no-lha          (cat "\nTo install AudioED it is required that LHA is installed. "
  373.                                "I can't include LHA due to license reasons into this distribution "
  374.                                "but you can easily get it from the Aminet. "
  375.                           )
  376.     )
  377.  
  378.     (set #extract-prg-0   (cat "\nExtracting AudioED for 68000..."
  379.                           )
  380.     )
  381.  
  382.     (set #extract-prg-1   (cat "\nExtracting AudioED for 68020+..."
  383.                           )
  384.     )
  385.  
  386.     (set #extract-err     (cat "\nError while extracting archive"
  387.                           )
  388.     )
  389.   )
  390. )
  391.  
  392. ;==========================================================================
  393. ; PROCEDURES
  394.  
  395. ;--------------------------------------------------------------------------
  396. ; Installation procedure. Installs AudioED and is used while install and
  397. ; update progress.
  398.  
  399. (procedure INSTALL
  400.   (
  401.     ; first clear the directory
  402.     ; (we use the external delete to be compatible to verion 2 of installer)
  403.  
  404.     (run (cat "c:delete \"" destination-drawer "/#?\" all force quiet"))
  405.  
  406.     ; now we copy the related language independent files
  407.  
  408.     ; drawer icon
  409.  
  410.     (copyfiles (source  "Install/audioed_drawer_icon")
  411.                (dest    (pathonly destination-drawer))
  412.                (newname "AudioED.info")
  413.     )
  414.  
  415.     ; readme file
  416.  
  417.     (copyfiles (source "Install/ReadMe")
  418.                (dest   destination-drawer)
  419.                (infos)
  420.     )
  421.  
  422.     ; installer skript which also uninstalls AudioED
  423.  
  424.     (copyfiles (source  "Install-AudioED")
  425.                (dest    destination-drawer)
  426.                (newname "Uninstall-AudioED")
  427.     )
  428.  
  429.     (copyfiles (source  "Install/uninstall_icon")
  430.                (dest    destination-drawer)
  431.                (newname "Uninstall-AudioED.info")
  432.     )
  433.  
  434.     ; registration program
  435.  
  436.     (copyfiles (source "Install/Register")
  437.                (dest   destination-drawer)
  438.     )
  439.  
  440.     (copyfiles (source "Install/ ")
  441.                (dest   destination-drawer)
  442.                (infos)
  443.     )
  444.  
  445.     ; main program
  446.  
  447.     (if (< "68010" (database "cpu"))
  448.       (
  449.         ; install for 68020+
  450.  
  451.         (working #extract-prg-1)
  452.  
  453.         (if (<> (run (cat "lha x Install/audioed_prg.lha AudioED_020 \"" destination-drawer "/\"")))
  454.           (
  455.             (abort #extract-err)
  456.           )
  457.         )
  458.  
  459.         (rename (tackon destination-drawer "AudioED_020") (tackon destination-drawer "AudioED"))
  460.       )
  461.       (
  462.         ; install for 68000
  463.  
  464.         (working #extract-prg-0)
  465.  
  466.         (if (<> (run (cat "lha x Install/audioed_prg.lha AudioED_000 \"" destination-drawer "/\"")))
  467.           (
  468.             (abort #extract-err)
  469.           )
  470.         )
  471.  
  472.         (rename (tackon destination-drawer "AudioED_000") (tackon destination-drawer "AudioED"))
  473.       )
  474.     )
  475.  
  476.     (copyfiles (source "Install/AudioED.info")
  477.                (dest   destination-drawer)
  478.     )
  479.  
  480.     ; library
  481.  
  482.     (copyfiles (source "Install/Libs")
  483.                (dest   (tackon destination-drawer "Libs"))
  484.                (infos)
  485.                (all)
  486.     )
  487.  
  488.     (copyfiles (source "Install/Libs.info")
  489.                (dest   destination-drawer)
  490.     )
  491.  
  492.     ; tapes
  493.  
  494.     (copyfiles (source "Install/Tapes")
  495.                (dest   (tackon destination-drawer "Tapes"))
  496.                (infos)
  497.                (all)
  498.     )
  499.  
  500.     (copyfiles (source "Install/Tapes.info")
  501.                (dest   destination-drawer)
  502.     )
  503.  
  504.     ; language related files
  505.  
  506.     ; manuals
  507.  
  508.     (makedir (tackon destination-drawer "Docs"))
  509.  
  510.     (copyfiles (source "Install/Docs.info")
  511.                (dest   destination-drawer)
  512.     )
  513.  
  514.     (if (BITAND man-lang 1)
  515.       (
  516.         ; english manual
  517.  
  518.         (copyfiles (source "Install/Docs/English")
  519.                    (dest   (tackon destination-drawer "Docs/English"))
  520.                    (infos)
  521.                    (all)
  522.         )
  523.  
  524.         (copyfiles (source "Install/Docs/English.info")
  525.                    (dest   (tackon destination-drawer "Docs"))
  526.         )
  527.       )
  528.     )
  529.  
  530.     (if (BITAND man-lang 2)
  531.       (
  532.         ; german manual
  533.  
  534.         (copyfiles (source "Install/Docs/Deutsch")
  535.                    (dest   (tackon destination-drawer "Docs/Deutsch"))
  536.                    (infos)
  537.                    (all)
  538.         )
  539.  
  540.         (copyfiles (source "Install/Docs/Deutsch.info")
  541.                    (dest   (tackon destination-drawer "Docs"))
  542.         )
  543.       )
  544.     )
  545.  
  546.     ; catalogs
  547.  
  548.     (makedir (tackon destination-drawer "Locale"))
  549.  
  550.     (copyfiles (source "Install/Locale.info")
  551.                (dest   destination-drawer)
  552.     )
  553.  
  554.     ; developer material
  555.  
  556.     (copyfiles (source "Install/Locale/AudioED_Strings.cd")
  557.                (dest   (tackon destination-drawer "Locale"))
  558.     )
  559.  
  560.     ; catalog files
  561.  
  562.     (makedir (tackon destination-drawer "Locale/catalogs"))
  563.  
  564.     ; english must not be processed since its the builtin language
  565.  
  566.     (if (BITAND cat-lang 2)
  567.       (
  568.         ; german locales
  569.  
  570.         (copyfiles (source "Install/Locale/catalogs/deutsch")
  571.                    (dest   (tackon destination-drawer "Locale/catalogs/deutsch"))
  572.                    (all)
  573.         )
  574.  
  575.         (copyfiles (source "Install/Locale/AudioED_deutsch.ct")
  576.                    (dest   (tackon destination-drawer "Locale"))
  577.         )
  578.       )
  579.     )
  580.  
  581.     (if (BITAND cat-lang 4)
  582.       (
  583.         ; swedish locales
  584.  
  585.         (copyfiles (source "Install/Locale/catalogs/svenska")
  586.                    (dest   (tackon destination-drawer "Locale/catalogs/svenska"))
  587.                    (all)
  588.         )
  589.  
  590.         (copyfiles (source "Install/Locale/AudioED_svenska.ct")
  591.                    (dest   (tackon destination-drawer "Locale"))
  592.         )
  593.       )
  594.     )
  595.  
  596.     (if (BITAND cat-lang 8)
  597.       (
  598.         ; swedish locales
  599.  
  600.         (copyfiles (source "Install/Locale/catalogs/français")
  601.                    (dest   (tackon destination-drawer "Locale/catalogs/français"))
  602.                    (all)
  603.         )
  604.  
  605.         (copyfiles (source "Install/Locale/AudioED_français.ct")
  606.                    (dest   (tackon destination-drawer "Locale"))
  607.         )
  608.       )
  609.     )
  610.  
  611.     ; here we install the keyfile but only if there's no keyfile installed
  612.  
  613.     (if (NOT (exists "ENVARC:AudioED.key"))
  614.       (
  615.         ; lets see if the given file is a real or a dummy keyfile
  616.  
  617.         (if keyfile-present
  618.           (
  619.             ; keyfile available
  620.  
  621.             (copyfiles (source "Keyfile/AudioED.key")
  622.                        (dest   "ENVARC:")
  623.             )
  624.  
  625.             (copyfiles (source "ENVARC:AudioED.key")
  626.                        (dest   "ENV:")
  627.             )
  628.           )
  629.           (
  630.             ; no keyfile... show user a message
  631.  
  632.             (message #no-keyfile)
  633.           )
  634.         )
  635.       )
  636.     )
  637.  
  638.     ; now we have to manipulate the user-startup
  639.  
  640.     (startup "AudioED"
  641.       (prompt  #user-startup)
  642.       (help    @startup-help)
  643.       (command "; derived from MUI-Startup-Code Copyright © Stefan Stuntz\n\n")
  644.       (command "if exists \"" destination-drawer "\"\n")
  645.       (command "   if exists \"" destination-drawer "/Libs\"\n")
  646.       (command "      assign add LIBS: \"" destination-drawer "/Libs\"\n")
  647.       (command "   endif\n\n")
  648.       (command "   if exists \"" destination-drawer "/Locale\"\n")
  649.       (command "      assign add LOCALE: \"" destination-drawer "/Locale\"\n")
  650.       (command "   endif\n\n")
  651.       (command "   version >nil: exec.library 39\n")
  652.       (command "   if not warn\n")
  653.       (command "      if exists \"" destination-drawer "/Docs\"\n")
  654.       (command "         if exists HELP:dummy ; do not remove\n")
  655.       (command "         endif                ; this entry!\n")
  656.       (command "         assign add HELP: \"" destination-drawer "/Docs\"\n")
  657.       (command "      endif\n")
  658.       (command "   endif\n")
  659.       (command "endif")
  660.     )
  661.   )
  662. )
  663.  
  664. ;--------------------------------------------------------------------------
  665. ; Update existing AudioED installation.
  666.  
  667. (procedure UPDATE
  668.   (
  669.     ; should we do a minor update?
  670.  
  671.     (if (AND (= old-ver 3) (= old-rev 12))
  672.       (
  673.         ; MINOR UPDATE
  674.  
  675.         ; in this case we just copy the main program, the manuals and the locale files
  676.  
  677.         ; readme file
  678.  
  679.         (copyfiles (source "Install/ReadMe")
  680.                    (dest   destination-drawer)
  681.                    (infos)
  682.         )
  683.  
  684.         ; installer skript which also uninstalls AudioED
  685.  
  686.         (copyfiles (source  "Install-AudioED")
  687.                    (dest    destination-drawer)
  688.                    (newname "Uninstall-AudioED")
  689.         )
  690.  
  691.         ; registration program
  692.  
  693.         (copyfiles (source "Install/Register")
  694.                    (dest   destination-drawer)
  695.         )
  696.  
  697.         ; main program
  698.  
  699.         (delete (tackon destination-drawer "AudioED") (optional force)
  700.         )
  701.  
  702.         (if (< "68010" (database "cpu"))
  703.           (
  704.             ; install for 68020+
  705.  
  706.             (working #extract-prg-1)
  707.  
  708.             (if (<> (run (cat "lha x Install/audioed_prg.lha AudioED_020 \"" destination-drawer "/\"")))
  709.               (
  710.                 (abort #extract-err)
  711.               )
  712.             )
  713.  
  714.             (rename (tackon destination-drawer "AudioED_020") (tackon destination-drawer "AudioED"))
  715.           )
  716.           (
  717.             ; install for 68000
  718.  
  719.             (working #extract-prg-0)
  720.  
  721.             (if (<> (run (cat "lha x Install/audioed_prg.lha AudioED_000 \"" destination-drawer "/\"")))
  722.               (
  723.                 (abort #extract-err)
  724.               )
  725.             )
  726.  
  727.             (rename (tackon destination-drawer "AudioED_000") (tackon destination-drawer "AudioED"))
  728.           )
  729.         )
  730.  
  731.         ; language related files
  732.  
  733.         ; manuals
  734.  
  735.         (makedir (tackon destination-drawer "Docs"))
  736.  
  737.         (copyfiles (source "Install/Docs.info")
  738.                    (dest   destination-drawer)
  739.         )
  740.  
  741.         (if (BITAND man-lang 1)
  742.           (
  743.             ; english manual
  744.  
  745.             (copyfiles (source "Install/Docs/English")
  746.                        (dest   (tackon destination-drawer "Docs/English"))
  747.                        (infos)
  748.                        (all)
  749.             )
  750.  
  751.             (copyfiles (source "Install/Docs/English.info")
  752.                        (dest   (tackon destination-drawer "Docs"))
  753.             )
  754.           )
  755.         )
  756.  
  757.         (if (BITAND man-lang 2)
  758.           (
  759.             ; german manual
  760.  
  761.             (copyfiles (source "Install/Docs/Deutsch")
  762.                        (dest   (tackon destination-drawer "Docs/Deutsch"))
  763.                        (infos)
  764.                        (all)
  765.             )
  766.  
  767.             (copyfiles (source "Install/Docs/Deutsch.info")
  768.                        (dest   (tackon destination-drawer "Docs"))
  769.             )
  770.           )
  771.         )
  772.  
  773.         ; catalogs
  774.  
  775.         (makedir (tackon destination-drawer "Locale"))
  776.  
  777.         (copyfiles (source "Install/Locale.info")
  778.                    (dest   destination-drawer)
  779.         )
  780.  
  781.         ; developer material
  782.  
  783.         (copyfiles (source "Install/Locale/AudioED_Strings.cd")
  784.                    (dest   (tackon destination-drawer "Locale"))
  785.         )
  786.  
  787.         ; catalog files
  788.  
  789.         (makedir (tackon destination-drawer "Locale/catalogs"))
  790.  
  791.         ; english must not be processed since its the builtin language
  792.  
  793.         (if (BITAND cat-lang 2)
  794.           (
  795.             ; german locales
  796.  
  797.             (copyfiles (source "Install/Locale/catalogs/deutsch")
  798.                        (dest   (tackon destination-drawer "Locale/catalogs/deutsch"))
  799.                        (all)
  800.             )
  801.  
  802.             (copyfiles (source "Install/Locale/AudioED_deutsch.ct")
  803.                        (dest   (tackon destination-drawer "Locale"))
  804.             )
  805.           )
  806.         )
  807.  
  808.         (if (BITAND cat-lang 4)
  809.           (
  810.             ; swedish locales
  811.  
  812.             (copyfiles (source "Install/Locale/catalogs/svenska")
  813.                        (dest   (tackon destination-drawer "Locale/catalogs/svenska"))
  814.                        (all)
  815.             )
  816.  
  817.             (copyfiles (source "Install/Locale/AudioED_svenska.ct")
  818.                        (dest   (tackon destination-drawer "Locale"))
  819.             )
  820.           )
  821.         )
  822.  
  823.         (if (BITAND cat-lang 8)
  824.           (
  825.             ; swedish locales
  826.  
  827.             (copyfiles (source "Install/Locale/catalogs/français")
  828.                        (dest   (tackon destination-drawer "Locale/catalogs/français"))
  829.                        (all)
  830.             )
  831.  
  832.             (copyfiles (source "Install/Locale/AudioED_français.ct")
  833.                        (dest   (tackon destination-drawer "Locale"))
  834.             )
  835.           )
  836.         )
  837.       )
  838.       (
  839.         ; MAJOR UPDATE
  840.  
  841.         ; tell user what we are going to do
  842.  
  843.         (message #update-info-0)
  844.  
  845.         ; rename existing drawer
  846.  
  847.         (set update-drawer (cat destination-drawer "_old"))
  848.         (rename destination-drawer update-drawer)
  849.         (rename (cat destination-drawer ".info") (cat update-drawer ".info"))
  850.  
  851.         ; inform user about our backups
  852.  
  853.         (message #update-info-1)
  854.  
  855.         ; create backups
  856.  
  857.         (makedir (tackon update-drawer "backup"))
  858.  
  859.         (working #work-backup)
  860.  
  861.         ; backup locale files
  862.  
  863.         (if (exists "LOCALE:catalogs/deutsch/audioed.catalog")
  864.           (
  865.             (makedir (tackon update-drawer "backup/catalogs"))
  866.             (makedir (tackon update-drawer "backup/catalogs/deutsch"))
  867.  
  868.             (copyfiles (source "LOCALE:catalogs/deutsch/audioed.catalog")
  869.                        (dest   (tackon update-drawer "backup/catalogs/deutsch" ))
  870.                        (infos)
  871.             )
  872.  
  873.             (delete "LOCALE:catalogs/deutsch/audioed.catalog" (optional force)
  874.                                                               (infos)
  875.             )
  876.           )
  877.         )
  878.  
  879.         (if (exists "LOCALE:catalogs/italiano/audioed.catalog")
  880.           (
  881.             (makedir (tackon update-drawer "backup/catalogs"))
  882.             (makedir (tackon update-drawer "backup/catalogs/italiano"))
  883.  
  884.             (copyfiles (source "LOCALE:catalogs/italiano/audioed.catalog")
  885.                        (dest   (tackon update-drawer "backup/catalogs/italiano" ))
  886.                        (infos)
  887.             )
  888.  
  889.             (delete "LOCALE:catalogs/italiano/audioed.catalog" (optional force)
  890.                                                                (infos)
  891.             )
  892.           )
  893.         )
  894.  
  895.         ; backup library
  896.  
  897.         (if (exists "LIBS:idx.library")
  898.           (
  899.             (makedir (tackon update-drawer "backup/libs"))
  900.  
  901.             (copyfiles (source "LIBS:idx.library")
  902.                        (dest   (tackon update-drawer "backup/libs" ))
  903.                        (infos)
  904.             )
  905.  
  906.             (delete "LIBS:idx.library" (optional force)
  907.                                        (infos)
  908.             )
  909.           )
  910.         )
  911.  
  912.         ; backup envarc file
  913.  
  914.         (if (exists "ENVARC:AudioED.resident")
  915.           (
  916.             (makedir (tackon update-drawer "backup/envarc"))
  917.  
  918.             (copyfiles (source "ENVARC:AudioED.resident")
  919.                        (dest   (tackon update-drawer "backup/envarc" ))
  920.                        (infos)
  921.             )
  922.  
  923.             (delete "ENVARC:AudioED.resident" (optional force)
  924.                                               (infos)
  925.             )
  926.           )
  927.         )
  928.  
  929.         ; backup tapes
  930.  
  931.         ; ask where the tape have been installed on previous versions
  932.  
  933.         (set tapes-drawer (askdir (prompt  #gettapes)
  934.                                   (help    @askdir-help)
  935.                                   (default def-volume)
  936.                           )
  937.         )
  938.  
  939.         (if (exists tapes-drawer)
  940.           (
  941.             (makedir (tackon update-drawer "backup/TapesBackup"))
  942.  
  943.             (foreach tapes-drawer "(#?.idx|#?.dat)"
  944.               (
  945.                 (copyfiles (source (tackon tapes-drawer @each-name))
  946.                            (dest   (tackon update-drawer "backup/TapesBackup"))
  947.                            (infos)
  948.                 )
  949.               )
  950.             )
  951.  
  952.             ; (we use the external delete to be compatible to verion 2 of installer)
  953.  
  954.             (run (cat "c:delete \"" (tackon tapes-drawer "#?.idx") "\" all force quiet"))
  955.             (run (cat "c:delete \"" (tackon tapes-drawer "#?.dat") "\" all force quiet"))
  956.           )
  957.         )
  958.  
  959.         ; create drawer for new installation
  960.  
  961.         (makedir destination-drawer)
  962.  
  963.         ; do installation
  964.  
  965.         (INSTALL)
  966.  
  967.         ; convert the resident file
  968.  
  969.         (if (exists (tackon update-drawer "backup/envarc/audioed.resident"))
  970.           (
  971.             (working #work-r-conv)
  972.  
  973.             (run (cat "Install/old2new \"" (tackon update-drawer "backup/envarc/audioed.resident") "\" CONFIG"))
  974.  
  975.             ; copy files to envarc
  976.  
  977.             (copyfiles (source "ENV:AudioED")
  978.                        (dest   "ENVARC:AudioED")
  979.                        (all)
  980.                        (infos)
  981.             )
  982.           )
  983.         )
  984.  
  985.         ; convert the databases
  986.  
  987.         (foreach (tackon update-drawer "backup/TapesBackup") "#?.idx"
  988.           (
  989.             (working #work-d-conv)
  990.  
  991.             ; get name without extension
  992.  
  993.             (set database-name (substr @each-name 0 (- (strlen @each-name) 4)))
  994.  
  995.             ; start conversion
  996.  
  997.             ; that looks really weird, but it works fine ;)
  998.  
  999.             (run (cat "Install/old2new \""
  1000.                       (tackon update-drawer (cat "backup/" (fileonly tapes-drawer) "/" database-name))
  1001.                       "\" \""
  1002.                       (tackon destination-drawer (cat "Tapes/" database-name)) "\" DATABASE"
  1003.                  )
  1004.             )
  1005.           )
  1006.         )
  1007.       )
  1008.     )
  1009.   )
  1010. )
  1011.  
  1012. ;--------------------------------------------------------------------------
  1013. ; Remove an existing AudioED installation.
  1014.  
  1015. (procedure REMOVE
  1016.   (
  1017.     ; remove drawer
  1018.     ; (we use the external delete to be compatible to verion 2 of installer)
  1019.  
  1020.     (run (cat "c:delete \"" destination-drawer "\" all force quiet"))
  1021.  
  1022.     ; remove envarc
  1023.     ; (we use the external delete to be compatible to verion 2 of installer)
  1024.  
  1025.     (run "c:delete \"ENVARC:AudioED\" all force quiet")
  1026.  
  1027.     (delete "ENVARC:AudioED.key" (optional force)
  1028.                                  (infos)
  1029.     )
  1030.  
  1031.     ; remove startup lines
  1032.  
  1033.     (startup "AudioED"
  1034.       (prompt  #user-startup-rm)
  1035.       (help    @startup-help)
  1036.     )
  1037.   )
  1038. )
  1039.  
  1040.  
  1041. ;==========================================================================
  1042. ; MAIN INSTALLATION
  1043.  
  1044. ;--------------------------------------------------------------------------
  1045. ; Check Kickstart version. Needs at least version 3.0 (V39).
  1046.  
  1047. (if (< (/ (getversion "exec.library" (resident)) 65536) 39 )
  1048.   (
  1049.     (abort #wrong-kickstart)
  1050.   )
  1051. )
  1052.  
  1053. ;--------------------------------------------------------------------------
  1054. ; Check wheather lha is available or not
  1055.  
  1056. (if (= (run "lha >NIL:") 10)
  1057.   (
  1058.     (abort #no-lha)
  1059.   )
  1060. )
  1061.  
  1062. ;--------------------------------------------------------------------------
  1063. ; Check for the keyfile
  1064.  
  1065. (if (exists "Keyfile/AudioED.key")
  1066.   (
  1067.     (if (<> (getsum "Keyfile/AudioED.key") $B81AA1DC)
  1068.       (
  1069.         (set keyfile-present 1)
  1070.       )
  1071.       (
  1072.         (set keyfile-present 0)
  1073.       )
  1074.     )
  1075.   )
  1076. )
  1077.  
  1078. ;--------------------------------------------------------------------------
  1079. ; Show welcome message.
  1080.  
  1081. (message #welcome)
  1082.  
  1083. ;--------------------------------------------------------------------------
  1084. ; Ok... let's start. Get name of Drawer.
  1085.  
  1086. (set destination-drawer (askdir (prompt  #getdrawer)
  1087.                                 (help    #getdrawer-help)
  1088.                                 (default def-volume)
  1089.                         )
  1090. )
  1091.  
  1092. ; Create full name
  1093.  
  1094. (set destination-drawer (tackon destination-drawer "AudioED"
  1095.                         )
  1096. )
  1097.  
  1098. ;--------------------------------------------------------------------------
  1099. ; If this drawer exists we try to obtain the version of the installed
  1100. ; AudioED. Else we create it silently.
  1101.  
  1102. (if (exists (tackon destination-drawer drawer-name))
  1103.   (
  1104.     ; directory exists so check for old version
  1105.     ; and say the script to ask for deleteing this
  1106.     ; version
  1107.  
  1108.     (set ask-remove 1)
  1109.  
  1110.     ; get version and revision number
  1111.  
  1112.     (set old-version (getversion (tackon destination-drawer "AudioED")))
  1113.     (set old-ver     (/ old-version 65536))
  1114.     (set old-rev     (- old-version (* old-ver 65536)))
  1115.  
  1116.     ; is there an older version?
  1117.  
  1118.     (if (OR (< old-ver new-ver) (< old-rev new-rev))
  1119.       (
  1120.         ; say skript to ask for update
  1121.  
  1122.         (set ask-update 1)
  1123.       )
  1124.       (
  1125.         (set ask-update 0)
  1126.       )
  1127.     )
  1128.   )
  1129.   (
  1130.     (set ask-remove 0)
  1131.  
  1132.     ; drawer was not found so we create it
  1133.  
  1134.     (makedir destination-drawer)
  1135.   )
  1136. )
  1137.  
  1138. ;--------------------------------------------------------------------------
  1139. ; Ask the user if he or she wants to update or delete
  1140.  
  1141. (if ask-update
  1142.   (
  1143.     ; ask for update or remove
  1144.  
  1145.     (set install-choice (askchoice (prompt  #deinst-update)
  1146.                                    (choices #deinst-ch-0
  1147.                                             #deinst-ch-1
  1148.                                    )
  1149.                                    (default 0)
  1150.                                    (help    @askchoice-help)
  1151.                         )
  1152.     )
  1153.  
  1154.     (if (= install-choice 0)
  1155.       (
  1156.         ; update selected
  1157.  
  1158.         (set do-update 1)
  1159.       )
  1160.       (
  1161.         ; remove selected
  1162.  
  1163.         (set do-remove 1)
  1164.       )
  1165.     )
  1166.   )
  1167.   (if ask-remove
  1168.     (
  1169.       (if keyfile-present
  1170.         (
  1171.           ; ask for remove or keyfile update
  1172.  
  1173.           (set install-choice (askchoice (prompt  #reinit-key)
  1174.                                          (choices #reinit-ch-0
  1175.                                                   #reinit-ch-1
  1176.                                          )
  1177.                                          (default 0)
  1178.                                          (help    @askchoice-help)
  1179.                               )
  1180.           )
  1181.  
  1182.           (if (= install-choice 0)
  1183.             (
  1184.               ; remove installation
  1185.  
  1186.               (set do-remove 1)
  1187.             )
  1188.             (
  1189.               ; copy the keyfile
  1190.  
  1191.               (copyfiles (source "Keyfile/AudioED.key")
  1192.                          (dest   "ENVARC:")
  1193.               )
  1194.  
  1195.               (copyfiles (source "ENVARC:AudioED.key")
  1196.                          (dest   "ENV:")
  1197.               )
  1198.  
  1199.               ; and that's it
  1200.  
  1201.               (exit (quiet))
  1202.             )
  1203.           )
  1204.         )
  1205.         (
  1206.           (if (askbool (prompt  #deinstall)
  1207.                        (help    @askbool-help)
  1208.                        (default 0)
  1209.                      )
  1210.             (
  1211.               ; yes selected - so we remove
  1212.  
  1213.               (set do-remove 1)
  1214.             )
  1215.             (
  1216.               ; no selected - so we quit
  1217.  
  1218.               (exit (quiet))
  1219.             )
  1220.           )
  1221.         )
  1222.       )
  1223.     )
  1224.     (
  1225.       ; no remove and no update so we install
  1226.  
  1227.       (set do-install 1)
  1228.     )
  1229.   )
  1230. )
  1231.  
  1232. ;--------------------------------------------------------------------------
  1233. ; Ask the user which catalog files should be installed.
  1234.  
  1235. (if (NOT do-remove)
  1236.   (
  1237.     (until (NOT (= cat-lang 0))
  1238.       (
  1239.         ; set default language
  1240.  
  1241.         (set cat-lang 1)
  1242.  
  1243.         (if (= @language "deutsch")  (set cat-lang 2))
  1244.         (if (= @language "svenska")  (set cat-lang 4))
  1245.         (if (= @language "français") (set cat-lang 8))
  1246.  
  1247.         (set cat-lang (askoptions (prompt  #lang-cat)
  1248.                                   (choices #lang-cat-ch-0
  1249.                                            #lang-cat-ch-1
  1250.                                            #lang-cat-ch-2
  1251.                                            #lang-cat-ch-3
  1252.                                   )
  1253.                                   (default cat-lang)
  1254.                                   (help    @askoptions-help)
  1255.                       )
  1256.         )
  1257.  
  1258.         (if (= cat-lang 0)
  1259.           (
  1260.             ; alert user if he made a wrong choice
  1261.  
  1262.             (message #lang-error)
  1263.           )
  1264.         )
  1265.       )
  1266.     )
  1267.   )
  1268. )
  1269.  
  1270. ;--------------------------------------------------------------------------
  1271. ; Ask the user which manuals should be installed.
  1272.  
  1273. (if (NOT do-remove)
  1274.   (
  1275.     (until (NOT (= man-lang 0))
  1276.       (
  1277.         ; set default language
  1278.  
  1279.         (set man-lang 1)
  1280.  
  1281.         (if (= @language "deutsch")  (set man-lang 2))
  1282.         (if (= @language "svenska")  (set man-lang 4))
  1283.         (if (= @language "français") (set man-lang 8))
  1284.  
  1285.         (set man-lang (askoptions (prompt  #lang-man)
  1286.                                   (choices #lang-man-ch-0
  1287.                                            #lang-man-ch-1
  1288.                                   )
  1289.                                   (default man-lang)
  1290.                                   (help    @askoptions-help)
  1291.                       )
  1292.         )
  1293.  
  1294.         (if (= man-lang 0)
  1295.           (
  1296.             ; alert user if he made a wrong choice
  1297.  
  1298.             (message #lang-error)
  1299.           )
  1300.         )
  1301.       )
  1302.     )
  1303.   )
  1304. )
  1305.  
  1306. ;--------------------------------------------------------------------------
  1307. ; We got now all the required information. So let's start with the
  1308. ; installation procedure.
  1309.  
  1310. (if do-install
  1311.   (
  1312.     ; do full new installation
  1313.  
  1314.     (INSTALL)
  1315.  
  1316.     (message #restart)
  1317.     (exit (quiet))
  1318.   )
  1319. )
  1320.  
  1321. (if do-update
  1322.   (
  1323.     ; do update installation
  1324.  
  1325.     (UPDATE)
  1326.  
  1327.     (message #restart)
  1328.     (exit (quiet))
  1329.   )
  1330. )
  1331.  
  1332. (if do-remove
  1333.   (
  1334.     ; remove the installation
  1335.  
  1336.     (REMOVE)
  1337.  
  1338.     (message #removed)
  1339.     (exit (quiet))
  1340.   )
  1341. )
  1342.  
  1343. (exit)
  1344.  
  1345.